from selenium.webdriver.common.by import By

import page
from base.base import Base

class PageOrder(Base):
    #点击我的购物车
    def page_open_my_cart(self):
        self.base_click(page.my_cart_btn)

    #勾选第一个商品
    def page_click_checkCartFrist(self):
        self.base_click(page.my_cart_checkCart_frist)

    #点击全选按钮
    def page_click_checkCartAll(self):
        self.base_click(page.my_cart_checkCartAll)

    #点击去结算
    def page_click_settle_account(self):
       self.base_click(page.my_cart_settle_account_btn)

    #定位收货信息
    def page_click_consignee(self):
        self.base_click(page.my_cart_consignee)


    #点击提交订单
    def page_click_submit_order(self):
        self.base_click(page.my_cart_submit_order_btn)

    #获取提交订单结果
    def page_get_submit_order_result_info(self):
       return self.base_get_text(page.my_cart_submit_order_result_info)


    #打开首页
    def page_open_index_page(self):
        self.driver.get(page.index_url)

    #组合下订单功能
    def page_order(self):
        #打开购物车
        self.page_open_my_cart()
        #选择商品
        self.page_click_checkCartAll()
        #点击去结算
        self.page_click_settle_account()
        #定位收货人
        self.page_click_consignee()
        #点击提交订单
        self.page_click_submit_order()


